﻿ n@using LanDBom.Models
@using LanDBom.Resources
@{
    ViewBag.Title = "Design_order";
}

@section styles{
    <style>
        span {
            color: red;
        }

        tbody td {
            width: 16%;
        }

        option {
            width: 100%;
        }
    </style>
}
<from>
    <div class="row" id="WT_CZ">
        <div id="WT_bc" class="col-2">@Resource.Stringbc</div>
        <div id="WT_tj" class="col-2">@Resource.String630</div>
        <div id="WT_qx" class="col-2">@Resource.String631</div>
    </div>
    <div id="WT_bz" style="display:none"></div>
    <div id="WT_dh_mb" style="display:none;position:fixed;background-color:white;top:200px;width:660px;left:300px;z-index:1000;border:1px black solid;">
        <table>
            <tr>
                <td>@Resource.String632：</td>
                <td id="WT_dhr"></td>
            </tr>
            <tr>
                <td>@Resource.String633</td>
                <td><textarea id="WT_dhly"></textarea></td>
            </tr>
            <tr>
                <td id="WT_qdbh">@Resource.String634</td>
                <td id="WT_qxbh">@Resource.String635</td>
            </tr>
        </table>
    </div>
    <div style="width:88%" id="bigbox">
        <fieldset class="boun">
            <legend class="len">@Resource.String637</legend>
            <table height="800px">
                <tbody>
                    <tr>
                        <td><span>*</span>@Resource.String638</td>
                        <td id="WT_sqrq"></td>
                        <td><span>*</span>@Resource.String639</td>
                        <td><input type="date" id="WT_yqrq" /></td>
                        <td>@Resource.String640</td>
                        <td id="WT_rwdh">@(Session["names_DTon"])</td>
                    </tr>
                    <tr>
                        <td><span>*</span>@Resource.String641</td>
                        <td><input type="text" id="WT_sqr" /></td>
                        <td><span>*</span>@Resource.String642</td>
                        <td><input type="text" id="WT_sqshr" /></td>
                        <td><span>*</span>@Resource.String643</td>
                        <td><input type="number" id="WT_xmjz" /></td>
                    </tr>
                    <tr>
                        <td><span>*</span>@Resource.String644</td>
                        <td style="position:relative">
                            <input type="text" id="WT_khmc" />
                            <div style="position:absolute;background-color:white;border:1px solid black;width:100%" id="WT_GET_khmc">

                            </div>
                        </td>
                        <td><span>*</span>@Resource.String645</td>
                        <td><input type="text" id="WT_cpmc" /></td>
                        <td>@Resource.String646</td>
                        <td >
                            <select id="WT_rwdlx">
                                <option value="null">----@Resource.String647----</option>
                                <option value="图纸">-@Resource.String649</option>
                                <option value="项目">-@Resource.String650</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span>*</span>@Resource.String652</td>
                        <td id="WT_sjlb">
                            <input type="checkbox" value="结构" class="WT_sjlb_ch" name="WT_sjlb" />@Resource.String654
                            <input type="checkbox" value="平面" class="WT_sjlb_ch" name="WT_sjlb" />@Resource.String656
                            <input type="checkbox" value="整体" class="WT_sjlb_ch" name="WT_sjlb" />@Resource.String658
                        </td>
                        <td><span>*</span>@Resource.String659</td>
                        <td>
                            <select id="WT_dj">
                                <option value="null">----@Resource.String660----</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                                <option value="D">D</option>
                            </select>
                        </td>
                    </tr>
                    <tr style="display:none">
                        <td>
                            <p></p>
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="3"><span>*</span>@Resource.String661</td>
                        <td>@Resource.String662</td>
                        <td><input type="number" id="WT_cpzl" /></td>
                        <td></td>
                        <td>@Resource.String663</td>
                        <td><input type="text" id="WT_ddsm" /></td>
                    </tr>
                    <tr>
                        <td rowspan="2">@Resource.String664</td>
                        <td rowspan="2" colspan="4"><textarea style="width:100%" id="WT_qtxx"></textarea></td>
                    </tr>
                    <tr style="display:none">
                    </tr>
                    <tr style="display:none">
                        <td>
                            <p></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p></p>
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="9"><span>*</span>@Resource.String665</td>
                        <td>@Resource.String666</td>
                        <td colspan="4" id="WT_ysfs">
                            <input type="checkbox" value="汽车运输" name="WT_ysfs" />@Resource.String667
                            <input type="checkbox" value="铁路运输" name="WT_ysfs" />@Resource.String669
                            <input type="checkbox" value="海轮运输" name="WT_ysfs" />@Resource.String671
                            <input type="checkbox" value="航空运输" name="WT_ysfs" />@Resource.String673
                            <input type="checkbox" value="其他" name="WT_ysfs" />@Resource.String675
                        </td>
                    </tr>
                    <tr>
                        <td>@Resource.String677</td>
                        <td colspan="4" id="WT_bzlx">
                            <input type="checkbox" value="内包装" name="WT_bzlx" />@Resource.String678
                            <input type="checkbox" value="外包装" name="WT_bzlx" />@Resource.String680
                            <input type="checkbox" value="单独包装" name="WT_bzlx" />@Resource.String682
                            <input type="checkbox" value="集合包装" name="WT_bzlx" />@Resource.String684
                        </td>
                    </tr>
                    <tr>
                        <td>@Resource.String686</td>
                        <td colspan="4" id="WT_fhyq">
                            <input type="checkbox" value="防震处理" name="WT_fhyq" />@Resource.String687
                            <input type="checkbox" value="防锈处理" name="WT_fhyq" />@Resource.String689
                            <input type="checkbox" value="防霉处理" name="WT_fhyq" />@Resource.String691
                            <input type="checkbox" value="防潮处理" name="WT_fhyq" />@Resource.String693
                            <input type="checkbox" value="防静电处理" name="WT_fhyq" />@Resource.String695
                            <input type="checkbox" value="屏蔽处理" name="WT_fhyq" />@Resource.String697
                            <input type="checkbox" value="String699" name="WT_fhyq" />@Resource.String699
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="3">@Resource.String701</td>
                        <td rowspan="3" colspan="4"><textarea style="width:100%" id="WT_qtyq"></textarea></td>
                    </tr>
                    <tr></tr>
                    <tr></tr>
                    <tr>
                        <td rowspan="3">@Resource.String702</td>
                        <td rowspan="3" colspan="4"><textarea style="width:100%" id="WT_csyq"></textarea></td>
                    </tr>
                    <tr></tr>
                    <tr></tr>
                    <tr>
                        <td>
                            <p></p>
                        </td>
                    </tr>
                    @if (MyAuthentication.IsLogin())
                    {
                        if (MyAuthentication.GetUsers().DE_shenfen == 4)
                        {
                            <tr>
                                <td colspan="6">
                                    @*当时设计主管时才会出现*@

                                    <table style="text-align:center">
                                        <thead>
                                            <tr style="background-color:white;text-align:center">
                                                <td>@Resource.String705</td>
                                                <td>@Resource.String706</td>
                                                <td>@Resource.String707</td>
                                                <td>@Resource.String708</td>
                                                <td>@Resource.String709</td>
                                            </tr>
                                        </thead>
                                        <tbody id="WT_JDR_Tb">
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td><a href="#" id="WT_JDR_TJ">@Resource.String710</a></td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </td>
                            </tr>
                        }
                        <!--else
                        {
                            <tr>
                                <td colspan="5">-->
                                    @*当时设计主管时才会出现*@
                                    <!--<table style="text-align:center">
                                        <thead>
                                            <tr style="background-color:white;text-align:center">
                                                <td>@Resource.String712</td>
                                                <td>@Resource.String713</td>
                                                <td>@Resource.String714</td>
                                                <td>@Resource.String715</td>
                                            </tr>
                                        </thead>
                                        <tbody id="WT_JDR_Tb">
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td><a href="#"> @Resource.String716</a></td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </td>
                                <td style="color:red">@Resource.String717</td>
                            </tr>
                        }-->
                    }
                    <tr>
                        <td>
                            <span>*</span>@Resource.String718
                        </td>
                        <td colspan="5" id="WT_xmbzfjxx">
                            <input type="checkbox" value="产品数据" name="WT_xmbzfjxx" />@Resource.String719
                            <input type="checkbox" value="产品图纸" name="WT_xmbzfjxx" />@Resource.String721
                            <input type="checkbox" value="包装图纸" name="WT_xmbzfjxx" />@Resource.String723
                            <input type="checkbox" value="图片" name="WT_xmbzfjxx" />@Resource.String725
                            <input type="checkbox" value="其他" name="WT_xmbzfjxx" />@Resource.String727
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4"></td>
                        <td>@Resource.String729</td>
                        <td><input type="text" id="WT_jdshy" class="Shu1" /></td>
                    </tr>
                    <tr>
                        <td>@Resource.String730</td>
                        <td id="WT_wcrq" colspan="3"></td>
                        <td>@Resource.String731</td>
                        <td><input type="text" id="WT_wcshy" class="Shu1" /></td>
                    </tr>
                </tbody>
            </table>
        </fieldset>
    </div>
</from>

@section scripts
{
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>
        //生成当前时间和随机单号
        $(function () {

            var DTon = $("#WT_rwdh").text()
            getContracts()
            
            $(document).on("click", "#WT_JDR_se", function (e) {
                ContactInformation($(e.target))
            })
            //添加联系方式的方法
            function ContactInformation(e) {
                var e_mail = e.val()
                var temp = e_mail.split("+")
                var lastElement = temp[0];
                e.parent().next().next().text(lastElement)
            }
            //添加设计经理驳回的按钮
            function back_1() {
                var bz = $("#WT_bz").text()
                if (bz == "2") {
                    console.log(bz)
                    $("#WT_CZ").append($(`<div id="WT_bh" class="col-2">@Resource.String704</div>`))
                }
            }
            $(document).on("click", "#WT_JDR_TJ", function (e) {
                receiver($(e.target))
            })
            //分配接单人的方法
            function receiver(e) {
                var index = e.text()
                if (index == "添加") {
                    var $tr = $(`
                    <tr style="background-color:white;text-align:center">
                        <td>
                            <select id="WT_JDR_se" class="WT_JDR_a2">
                            <option value="">——@Resource.String711——</option>
                                @foreach (var item in ViewBag.res as List <LanDBom.Models.Dengli>)
                                 {
                                    if (item.DE_bumeng==2)
                                    {
                                        <option value="@item.DE_phone+@item.DE_nae+@item.DE_ID">@item.DE_nae</option>
                                    }

                                 }
                            </select>
                        </td>
                        <td>@Resource.String732</td>
                        <td></td>
                        <td><input  type="text"/></td>
                        <td><a href="#" id="WT_JDR_TJ">@Resource.String733</a></td>
                    </tr>
                    `)
                    $("#WT_JDR_Tb").append($tr)
                }
                else {
                    e.parent().parent().remove()
                }
            }

            function getContracts() {
                $.ajax({
                    url: "/Contracts/Design_order",
                    type: 'GET',
                    data: { "state": 1, "DTon": DTon },
                    success: function (data) {
                        Show_old_data(data);
                        back_1()
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            }

            //写入旧数据的方法
            function Show_old_data(data) {
                $.each(data, function (i, item) {
                    $("#WT_sqrq").text(item.D_Applic)
                    $("#WT_yqrq").val(item.D_reDate)
                    $("#WT_rwdh").text(item.D_Ton)
                    $("#WT_sqr").val(item.D_App)
                    $("#WT_sqshr").val(item.D_AppRevi)
                    $("#WT_khmc").val(item.D_CN)
                    $("#WT_cpmc").val(item.D_PN)
                    $("#WT_dj").val(item.D_LV)
                    $("#WT_sjhs").val(item.D_DT)
                    $('#WT_cpzl').val(item.D_PW)
                    $('#WT_ddsm').val(item.D_SI)
                    $('#WT_qtxx').val(item.D_OI)
                    $('#WT_qtyq').val(item.D_OR)
                    $('#WT_csyq').val(item.D_SR)
                    $('#WT_jdr').val(item.D_REC)
                    $('#WT_jdshy').val(item.D_AR)
                    $('#WT_wcrq').text(item.D_CD)
                    $('#WT_wcshy').val(item.D_TCA)
                    $('#WT_xmjz').val(item.D_price)
                    $("#WT_bz").text(item.D_zhuang)
                    console.log($("WT_bz").text())
                    //设计类别
                    if (item.D_DE != null) {
                        var D_DE = item.D_DE.split(" ")
                        D_DE.pop()
                        console.log(D_DE)
                        $("input[name='WT_sjlb']").each(function (i, a) {
                            if (D_DE.includes(a.value) == true) {
                                a.checked = true
                            }
                        })
                    }
                    //任务单类型
                    if (item.D_take != null) {
                        var D_DE = item.D_take.split(" ")
                        D_DE.pop()
                        console.log(D_DE)
                        $("input[name='WT_sjlb']").each(function (i, a) {
                            if (D_DE.includes(a.value) == true) {
                                a.checked = true
                            }
                        })
                    }
                    if (item.D_MOF != null ) {
                        //运输方式
                        var D_MOF = item.D_MOF.split(" ")
                        D_MOF.pop()
                        console.log(D_MOF)
                        $("input[name='WT_ysfs']").each(function (i, b) {
                            if (D_MOF.includes(b.value) == true) {
                                b.checked = true
                            }
                        })
                    }
                    if ( item.D_PT != null) {
                        //包装方式
                        var D_PT = item.D_PT.split(" ")
                        D_PT.pop()
                        console.log(D_PT)
                        $("input[name='WT_bzlx']").each(function (i, c) {
                            if (D_PT.includes(c.value) == true) {
                                c.checked = true
                            }
                        })
                    }
                    if ( item.D_PR != null ) {
                        //防护要求
                        var D_PR = item.D_PR.split(" ")
                        D_PR.pop()
                        console.log(D_PR)
                        $("input[name='WT_fhyq']").each(function (i, d) {
                            if (D_PR.includes(d.value) == true) {
                                d.checked = true
                            }
                        })
                    }
                    if ( item.D_PA!=null) {
                        //项目附件
                        var D_PA = item.D_PA.split(" ")
                        D_PA.pop()
                        console.log(D_PA)
                        $("input[name='WT_xmbzfjxx']").each(function (i, e) {
                            if (D_PA.includes(e.value) == true) {
                                e.checked = true
                            }
                        })
                    }

                })
            }

            //产生随机单号和当前时间的方法
            //function randomGeneration() {
            //    //产生随机数
            //    var x = 1000000
            //    var y = 9999999
            //    var num = parseInt(Math.random() * (x - y + 1) + y)

            //    //获取当前年月日
            //    var now = new Date($.now());
            //    var year = (now.getFullYear()).toString();
            //    var month = (now.getMonth() + 1).toString();
            //    var date = (now.getDate()).toString();
            //    var hours = (now.getHours()).toString()
            //    var minutes = (now.getMinutes()).toString()
            //    var daytime = year + month + date

            //   //组合当前日期
            //    var sqrq = year + "/" + month + "/" + date + " " + hours + ":" + minutes
            //    //写入当年月日
            //    $("#WT_rwdh").text(random)
            //}
        })

        $(function () {
            //新增委托的方法
            function append_Contracts(zhuang) {
                var jdr = ""
                $(".WT_JDR_a2").each(function (i, item) {
                    var index = $(item).val()
                    var temp = index.split(" ")
                    var lastElement = temp[1];
                    jdr += lastElement + " "
                })
                var box1_1 = ""
                var box2_1 = ""
                var box3_1 = ""
                var box4_1 = ""
                var box5_1 = ""
                var box1 = $("#WT_sjlb input[type=checkbox]:checked").serializeArray()
                var box2 = $("input[name='WT_ysfs']:checked").serializeArray()
                var box3 = $("input[name='WT_bzlx']:checked").serializeArray()
                var box4 = $("input[name='WT_fhyq']:checked").serializeArray()
                var box5 = $("input[name='WT_xmbzfjxx']:checked").serializeArray()
                $.each(box1, function (i, item) {
                    box1_1 += item.value + " "
                })
                $.each(box2, function (i, item) {
                    box2_1 += item.value + " "
                })
                $.each(box3, function (i, item) {
                    box3_1 += item.value + " "
                })
                $.each(box4, function (i, item) {
                    box4_1 += item.value + " "
                })
                $.each(box5, function (i, item) {
                    box5_1 += item.value + " "
                })
                var bcxx = {
                    D_Applic: $('#WT_sqrq').text(),
                    D_reDate: $('#WT_yqrq').val(),
                    D_price:$('#WT_xmjz').val(),
                    D_Ton: $('#WT_rwdh').text(),
                    D_App: $('#WT_sqr').val(),
                    D_AppRevi: $('#WT_sqshr').val(),
                    D_CN: $('#WT_khmc').val(),
                    D_PN: $('#WT_cpmc').val(),
                    D_take: $('#WT_rwdlx option:selected').val(),
                    D_DE: box1_1,
                    D_LV: $('#WT_dj').val(),
                    D_DT: $('#WT_sjhs ').val(),
                    D_PW: $('#WT_cpzl').val(),
                    D_SI: $('#WT_ddsm').val(),
                    D_OI: $('#WT_qtxx').val(),
                    D_MOF: box2_1,
                    D_PT: box3_1,
                    D_PR: box4_1,
                    D_OR: $('#WT_qtyq').val(),
                    D_SR: $('#WT_csyq').val(),
                    D_PA: box5_1,
                    D_REC: jdr,
                    D_AR: $('#WT_jdshy').val(),
                    D_CD: $('#WT_wcrq').text(),
                    D_TCA: $('#WT_wcshy').val(),
                    D_zhuang: zhuang
                };
                //---------------------------------------------------------------新增功能
                console.log(bcxx)
                $.ajax({
                    url: "/Contracts/Temporary_storage",
                    type: "POST",
                    data: bcxx,
                    success: function (data) {
                        alert(data)
                    },
                    error: function (data) {
                        alert("erroer");
                    },
                })
            }
            //修改委托的方法
            function edit_Contracts(zhuang) {
                var jdr = ""
                $(".WT_JDR_a2").each(function (i, item) {
                    var index = $(item).val()
                    var temp = index.split("+")
                    var lastElement = temp[1];
                    jdr += lastElement + " "
                })
                var box1_1 = ""
                var box2_1 = ""
                var box3_1 = ""
                var box4_1 = ""
                var box5_1 = ""
                var box1 = $("#WT_sjlb input[type=checkbox]:checked").serializeArray()
                var box2 = $("input[name='WT_ysfs']:checked").serializeArray()
                var box3 = $("input[name='WT_bzlx']:checked").serializeArray()
                var box4 = $("input[name='WT_fhyq']:checked").serializeArray()
                var box5 = $("input[name='WT_xmbzfjxx']:checked").serializeArray()
                $.each(box1, function (i, item) {
                    box1_1 += item.value + " "
                })
                $.each(box2, function (i, item) {
                    box2_1 += item.value + " "
                })
                $.each(box3, function (i, item) {
                    box3_1 += item.value + " "
                })
                $.each(box4, function (i, item) {
                    box4_1 += item.value + " "
                })
                $.each(box5, function (i, item) {
                    box5_1 += item.value + " "
                })
                var bcxx = {
                    D_Applic: $('#WT_sqrq').text(),
                    D_reDate: $('#WT_yqrq').val(),
                    D_price: $('#WT_xmjz').val(),
                    D_Ton: $('#WT_rwdh').text(),
                    D_App: $('#WT_sqr').val(),
                    D_AppRevi: $('#WT_sqshr').val(),
                    D_CN: $('#WT_khmc').val(),
                    D_PN: $('#WT_cpmc').val(),
                    D_take: $('#WT_rwdlx option:selected').val(),
                    D_DE: box1_1,
                    D_LV: $('#WT_dj').val(),
                    D_DT: $('#WT_sjhs ').val(),
                    D_PW: $('#WT_cpzl').val(),
                    D_SI: $('#WT_ddsm').val(),
                    D_OI: $('#WT_qtxx').val(),
                    D_MOF: box2_1,
                    D_PT: box3_1,
                    D_PR: box4_1,
                    D_OR: $('#WT_qtyq').val(),
                    D_SR: $('#WT_csyq').val(),
                    D_PA: box5_1,
                    D_REC: jdr,
                    D_AR: $('#WT_jdshy').val(),
                    D_CD: $('#WT_wcrq').text(),
                    D_TCA: $('#WT_wcshy').val(),
                    D_dhr: $("#WT_dhr").text(),
                    D_dhly: $("#WT_dhly").val(),
                    D_zhuang: zhuang
                };
                console.log(bcxx)
                //---------------------------------------------------------------------------------------修改功能
                $.ajax({
                    url: "/Contracts/Submit",
                    type: "POST",
                    data: bcxx,
                    success: function (data) {
                        console.log(data)
                        alert(data)
                    },
                    error: function (data) {
                        alert("erroer ");
                    },
                })
                //var khm = "18118449109@163.com"
                //$.ajax({
                //    url: "/Contracts/SendEmails",
                //    type: "POST",
                //    data: { "name": khm },
                //    success: function (data) {
                //        alert("邮件发送成功")
                //    },
                //    error: function (data) {
                //        alert("erroer ");
                //    },
                //})
            }
            //判断数据库是否有相同单号的方法
            function find_Contracts_with_D_Ton(zhuang) {
                var WT_rwdh = $("#WT_rwdh").text();
                $.ajax({
                    url: "/Contracts/find_Contracts",
                    type: "POST",
                    data: { "D_Ton": WT_rwdh },
                    success: function (data) {
                        if (data == "申请单已存在") {
                            console.log(zhuang)
                            edit_Contracts(zhuang)
                        }
                        else {
                            console.log(zhuang)
                            append_Contracts(zhuang)
                        }
                    },
                    error: function (data) {
                        alert("erroer ");
                    },
                })
            }
            function Find_KHXX() {
                var khm = $("#WT_khmc").val()
                if (khm != "") {
                    console.log(khm)
                    $.ajax({
                        url: "/Contracts/find_Client_name",
                        type: "POST",
                        data: { "name": khm },
                        success: function (data) {
                            createTR(data)

                        },
                        error: function (data) {
                            alert("erroer ");
                        },
                    })
                }
                else {
                    $('#WT_GET_khmc div').remove();
                }
            }

            function createTR(data) {
                $('#WT_GET_khmc div').remove();
                $.each(data, function (i, item) {
                    var $div = $(`
                         <div id="CL_name" style="text-align:center;border-bottom:1px solid black;padding:3px 3px 3px 3px;">${item.CL_name}</div>
                     `);
                    $('#WT_GET_khmc').append($div);
                })
                $(document).on("click", "#CL_name", function (e) {
                    $("#WT_khmc").val($(e.target).text())
                    $('#WT_GET_khmc div').remove();
                })
            }
            function SJ_BEIZ() {
                var XMBZ = []
                $(".WT_JDR_a2").each(function (i, item) {
                    var index = $(item).val()
                    var temp = index.split("+")
                    var lastElement = temp[2];
                    var bz = $(item).parent().next().next().next().children().first().val()
                    XMBZ.push({
                        SJR_id: lastElement,//接单人id
                        SJ_BZ: bz,//备注
                        SJ_Bian: $("#WT_rwdh").text(),//申请单号
                    })
                    console.log("共" + XMBZ.length + "数据");
                    console.log(XMBZ);
                })
                if (XMBZ.length > 0) {
                    $.ajax({
                        url: "/Contracts/ADDSJBZ",
                        type: "POST",
                        data: JSON.stringify(XMBZ),
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (text) {
                            alert(text)
                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                }
            }
            //点击保存现有数据
            $(document).on("click", "#WT_bc", function (e) {
                var zhuang = $("#WT_bz").text()
                find_Contracts_with_D_Ton(zhuang)

            })
            //点击打开驳回面板
            $(document).on("click", "#WT_bh", function (e) {
                $("#WT_dh_mb").css({ "display": "block" })
                var num = $("#Login_N").text()
                $("#WT_dhr").text(num)
            })
            //点击关闭驳回面板
            $(document).on("click", "#WT_qxbh", function (e) {
                $("#WT_dh_mb").css({ "display": "none" })
                $("#WT_dhly").val("")
                $("#WT_dhr").text("")
            })
            //点击驳回到业务
            $(document).on("click", "#WT_qdbh", function (e) {
                $("#WT_dh_mb").css({ "display": "none" })
                var zhuang = "1"
                find_Contracts_with_D_Ton(zhuang)
                window.location.href = "/Contracts/Inspect_Contracts"

            })
            //点击提交申请单
            $(document).on("click", "#WT_tj", function (x) {
                var bz = $("#WT_bz").text()
                alert(bz)
                var zhuang
                if (bz == "1") {
                    zhuang = "2"
                }
                else if (bz=="2") {
                    zhuang = "3"
                }
                find_Contracts_with_D_Ton(zhuang)
                SJ_BEIZ()
                window.location.href = "/Contracts/Inspect_Contracts"
            })
            //点击返回查看页
            $(document).on("click", "#WT_qx", function () {
                window.location.href = "/Contracts/Inspect_Contracts"
            })
            //输入修改搜索客户名
            $(document).on("keydown", "#WT_khmc", function () {
                Find_KHXX()
            })
            var suhg = $("#Login_N").text()
            $("#WT_sqr").val(suhg.slice(33, 50))
        })


    </script>
}